package com.vshop.controller.alast.multiple;


import com.vshop.config.dto.ResultDataDto;
import com.vshop.entity.alast.multiple.order.request.RequestMultipleOrder;
import com.vshop.entity.alast.multiple.order.response.ResponseMultipleOrder;
import com.vshop.entity.alast.multiple.serviceplan.request.RequestMultipleServicePlanPage;
import com.vshop.entity.alast.multiple.verify.request.RequestMultipleVerify;
import com.vshop.entity.alast.multiple.verify.response.ResponseMultipleVerify;
import com.vshop.entity.alast.single.serviceplan.response.ResponseSingleServicePlanPage;
import com.vshop.service.alast.LogicProcessesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Multiple模式所有接口
 * 包含：验证卡片，套餐列表，订购下单
 *
 * @author lm
 * @date 2020/6/30 14:54
 */
@RestController
@Api(value = "Multiple模式所有接口")
public class MultipleDeviceController {

    @Autowired
    LogicProcessesService multipleService;

    /**
     * Multiple模式卡片验证接口：
     * 1，验证卡片的有效性。
     * 2，验证卡片企业归属。
     * 3，验证卡片是否在除“废旧回收期”和“内部库存期”内。
     * 4，验证卡片归属企业的方案
     * 5，两张卡对应的套餐比对是否一致
     * <p>
     * 返回格式是：{"data":{},"message":"string","operateCode":"string"},ResponseMultipleVerify是data部分
     *
     * @param request
     * @return
     */
    @CrossOrigin
    @PostMapping(value = "multipleVerify", produces = "application/json;charset=utf-8")
    @ApiOperation(value = "Multiple模式：多卡片验证接口", response = ResponseMultipleVerify.class)
    public ResultDataDto multipleVerify(@ApiParam @RequestBody RequestMultipleVerify request) {
        return multipleService.multipleVerify(request);
    }


    /**
     * Multiple模式卡片可购套餐列表
     * <p>
     * 返回格式是：{"data":{},"message":"string","operateCode":"string"},ResponseMultipleServicePlanPage是data部分
     *
     * @param request
     * @return
     */
    @CrossOrigin
    @PostMapping(value = "multipleServicePlanPage", produces = "application/json;charset=utf-8")
    @ApiOperation(value = "Multiple模式：多卡片可购套餐列表接口", response = ResponseSingleServicePlanPage.class)
    public ResultDataDto multipleServicePlanPage(@ApiParam @RequestBody RequestMultipleServicePlanPage request) {
        return multipleService.multipleServicePlanPage(request);
    }

    /**
     * Multiple模式卡片：下单接口
     * <p>
     * 返回格式是：{"data":{},"message":"string","operateCode":"string"},ResponseMultipleOrder是data部分
     *
     * @param request
     * @return
     */
    @CrossOrigin
    @PostMapping(value = "multipleOrder", produces = "application/json;charset=utf-8")
    @ApiOperation(value = "Multiple模式：多卡片下单接口", response = ResponseMultipleOrder.class)
    public ResultDataDto multipleOrder(@ApiParam @RequestBody RequestMultipleOrder request) {
        return multipleService.multipleOrder(request);
    }


}
